[Thread Prev][Thread Next][Index]

Re: Includes in LAS xml files



Hi Ben,

You and Jean-Marie are correct, closing tags must be included in an external XML Entity with start tags.  I have no work around for this.  In the future LAS will be using a different XML schema in which each element will have an ID attribute which can be used as reference, but we are faced with the same issue.  The referenced variable element includes the grid association in its definition and cannot be separated from it.  I'm afraid you will have to use the complete variable starting tag line for your XML.

Joe



Ben Burford wrote:
Hello Jean-Marie,

I tried you idea and it works!  However, it negates what I'm trying to accom
plish!!

I don't want to include the second line ( <link match="/lasdata/grids/DGS_XY
ZT_grid"/> )  in the xml include file, because it has to be unique for each 
file.  I have about 200 sets of automated weather station time series data f
rom different locations.  This will result in my creating 200 files like CEO
P_Insitu_Surface_Mongolia_DGS.xml  all of which have the same set of 19 vari
ables (e.g. Air_Temperature), but all of which have a different station name
 (i.e. the "DGS" part, and all have a different lat/lon location).  The stru
cture of my CEOP_Insitu_Surface_Mongolia_DGS.xml  file looks like this:

<datasets>
 <Insitu_Surface_Mongolia_DGS name="CEOP Surface Mongolia DGS"
                   url=""
                   doc="">
  <properties>
(stuff deleted)
  </properties>

  <variables>

   <Air_Temperature name="Air Temperature" units="Celsius">
    <link match="/lasdata/grids/DGS_XYZT_grid"/>
   </Air_Temperature>

   <Dew_Point_Temperature name="Dew Point Temperature" units="Celsius">
    <link match="/lasdata/grids/DGS_XYZT_grid"/>
   </Dew_Point_Temperature>

(etc., continues for a total of 19 variables)

  </variables>

 </Insitu_Surface_Mongolia_DGS>
</datasets>
<grids>
 <DGS_XYZT_grid>
  <link match="/lasdata/axes/DGS_X"/>
  <link match="/lasdata/axes/DGS_Y"/>
  <link match="/lasdata/axes/DGS_T"/>
 </DGS_XYZT_grid>
</grids>
<axes>
 <DGS_X units="degree_east" type="x">
  <arange start="106.369" step="1" size="1"/>
 </DGS_X>
 <DGS_Y units="degree_north" type="y">
  <arange start="46.1273" step="1" size="1"/>
 </DGS_Y>
 <DGS_T units="hours" type="t">
  <arange start="2002-Oct-01 01:00:00" step="1" size="48"/>
 </DGS_T>
</axes>


The structure "DGS_ . . ." (shown in these next lines):

    <link match="/lasdata/grids/DGS_XYZT_grid"/>

 <DGS_XYZT_grid>
  <link match="/lasdata/axes/DGS_X"/>
  <link match="/lasdata/axes/DGS_Y"/>
  <link match="/lasdata/axes/DGS_T"/>
 </DGS_XYZT_grid>

 <DGS_X units="degree_east" type="x">
 </DGS_X>
 <DGS_Y units="degree_north" type="y">
 </DGS_Y>
 <DGS_T units="hours" type="t">
 </DGS_T>

The structure "DGS_ . . ." has to be unique in each of the 200 files.  So if
 my include includes all three lines, i.e. if  &InsituAirTemperature; includ
es:
   <Air_Temperature name="Air Temperature" units="Celsius">
    <link match="/lasdata/grids/DGS_XYZT_grid"/>
   </Air_Temperature>

then the "DGS_XYZT" part is repeated, and xml doesn't allow repeats of this 
in the 200 files.  

I want a single copy of the following line identical/repeated in 200 files:
   <Air_Temperature name="Air Temperature" units="Celsius">

but I can't have the second line repeated at all:
    <link match="/lasdata/grids/DGS_XYZT_grid"/>

I may be stuck with an unfriendly structure.  Does anybody see any solutions?

Thank you,

Ben



At 09:11 2004/10/07 +0200, you wrote:
  
Ben,

yes, I believe I can see what is wrong...

I guess that the entity you include should contain a valid start tag match
    
ed with
  
a valid end tag.

In your example, file Insitu_Air_Temperature.xml should contain all the th
    
ree
  
lines:
  <Station_Pressure name="Station Pressure" units="hPa (mb)">
    <link match="/lasdata/grids/DGS_XYZT_grid"/>
   </Station_Pressure>

matching <Station_Pressure ...> start tag with   </Station_Pressure>

Did you try that ?

Jean-Marie Epitalon



Ben Burford wrote:

    
Hi Joe,

Thanks, but it didn't work.  I hope someone can spot a problem (like may
      
be a
  
 missing semicolon).  Here are the details:

I modified my las.xml file as follows:
<?xml version='1.0' ?>
<!DOCTYPE spec SYSTEM "spec.dtd" [

<!-- Declaration of operations files to be included -->
<!ENTITY StdOperations SYSTEM "operations.xml">
<!ENTITY insitu_operations SYSTEM "insitu_operations.xml">

<!-- Declaration of dataset files to be included -->
<!ENTITY InsituDatasets SYSTEM "Insitu_Datasets.xml">

(note: this next item was already in the las.xml file)
<!-- Declaration of variables files to be included -->
<!ENTITY CEOP_Insitu_Surface_Mongolia_DGS SYSTEM "CEOP_Insitu_Surface_Mo
      
ngol
  
ia_DGS.xml">

(note: I added this next item to the xml.file)
<!-- Declaration of variable names files to be included -->
<!ENTITY InsituAirTemperature SYSTEM "Insitu_Air_Temperature.xml">
]>

<lasdata>
  <las_categories>
  &InsituDatasets;
  </las_categories>
(note: other stuff deleted)

(note: this next line was already in las.xml)
<!-- Datasets provided by this server -->
&CEOP_Insitu_Surface_Mongolia_DGS;
</lasdata>

Next, I created a new xml file Insitu_Air_Temperature.xml containing thi
      
s on
  
e line:
   <Station_Pressure name="Station Pressure" units="hPa (mb)">

Next, I modified the file CEOP_Insitu_Surface_Mongolia_DGS.xml as follows.
First, the original version:
<datasets>
 <Insitu_Surface_Mongolia_DGS name="CEOP Surface Mongolia DGS"
                   url=""
                   doc="">
(note: other stuff deleted)
  <variables>
   <Station_Pressure name="Station Pressure" units="hPa (mb)">
    <link match="/lasdata/grids/DGS_XYZT_grid"/>
   </Station_Pressure>

I modified this file by replacing one line in the variables section as f
      
ollo
  
ws:
  <variables>
   &InsituAirTemperature;
    <link match="/lasdata/grids/DGS_XYZT_grid"/>
   </Station_Pressure>

The error message that I got from the make was:

asynchronous entity at line 2, column 0, byte 63:
   <Station_Pressure name="Station Pressure" units="hPa (mb)">

^

error in processing external entity reference at line 32, column 3, byte
      
 901:
  
  <variables>

   &InsituAirTemperature;
==^
    <link match="/lasdata/grids/DGS_XYZT_grid"/>
   </Station_Pressure>

error in processing external entity reference at line 53, column 0, byte
      
 1649:
  
<!-- Datasets provided by this server -->
^
&CEOP_Insitu_Surface_Mongolia_DRS;
 at /usr/lib/perl5/site_perl/5.6.0/i386-linux/XML/Parser.pm line 185
make: *** [../ui/config.js] Error 255

What does "asynchronous entity" mean in this case?

After this I tried one more thing.  I added    &InsituAirTemperature;  t
      
o la
  
s.xml as follows:
<!-- Datasets provided by this server -->
&CEOP_Insitu_Surface_Mongolia_DGS;
&InsituAirTemperature;
</lasdata>

But I got exactly the same error message.

Does anyone see anything wrong?

Thanks,

Ben

At 15:13 2004/10/06 -0700, you wrote:
      
Hi Ben,
I have no example for you at the moment, but I have an explanation which
I think will help.
XML ENTITIES are declared in the DOCTYPE definition which must be
declared before the first element in the XML document.
Therefore all ENTITIES must be declared in your root document which by
default is las.xml (the first xml element in the las.xml file is <lasd
        
ata>)
  
Once it is declared there, then you can use the reference anywhere
within the document
i.e.
these two Entities are declared in the las.xml DOCTYPE definition
-----------------------------
<?xml version='1.0' ?>
<!DOCTYPE spec SYSTEM "spec.dtd" [

<!-- Declaration of dataset files to be included -->
<!ENTITY ceop_surf_mong_dgs SYSTEM "CEOP_Insitu_Surface_Mongolia_DGS.x
        
ml">
  
<!-- Other Entities -->
<!ENTITY VarNameStationPressure SYSTEM "Var_Name_Station_Pressure.xml">

]>
<lasdata>
[...]
------------------------------
now you can use "&ceop_surf_mong_dgs;" as a reference in the las.xml
document and you can use "&VarNameStationPressure;" in the las.xml
document or in CEOP_Insitu_Surface_Mongolia_DGS.xml.

Hope this helps.

Joe
-------------------------------------

Ben Burford wrote:

        
Hello All,

I'm a beginner at XML and I'm building LAS menus.  I have a category 
          
file
  
 th
      
at (partially) looks like:

(file is Insitu_Datasets.xml)
<category name="Insitu">

 <category name="Surface">

<category name="CAMP_Mongolia">
     <category name="BTS">
       <filter action="" equals="CEOP Surface Mongolia 
          
BTS"/>
  
     </category>

(this leads to the file CEOP_Insitu_Surface_Mongolia_DGS.xml which co
          
ntai
  
ns)
      
<datasets>
<Insitu_Surface_Mongolia_DGS name="CEOP Surface Mongolia DGS"
                  url=""
                  doc="">
 <properties>
 (properties stuff not important)
 </properties>

 <variables>

  <Station_Pressure name="Station Pressure" units="hPa (mb)">
   <link match="/lasdata/grids/DGS_XYZT_grid"/>
  </Station_Pressure>

(etc. for more variables, then grids then axes).
In this line:
  <Station_Pressure name="Station Pressure" units="hPa (mb)">

Station Pressure  will appear as a menu entry.  This list of variable
          
s wi
  
ll
      
appear in about 100 different menu pages (and therefore in about 100 
          
diff
  
ere
      
nt xml files, one for each location) for several locations and statio
          
ns w
  
ith
      
in locations.  I want to make this line an xml file/xml include so th
          
at,
  
if
      
I want to change the text of the menu item, I only change it in the o
          
ne x
  
ml
      
file, and not 100 xml files.  In other words, I want to create the xm
          
l fi
  
le
      
Var_Name_Station_Pressure.xml which would contain one line:

  <Station_Pressure name="Station Pressure" units="hPa (mb)">

and then in CEOP_Insitu_Surface_Mongolia_DGS.xml put &VarNameStationP
          
ress
  
ure
      
; as in:

<variables>

  &VarNameStationPressure;
   <link match="/lasdata/grids/DGS_XYZT_grid"/>
  </Station_Pressure>

so the 1 line would be substituted.  I created the xml file Var_Name_
          
Stat
  
ion
      
_Pressure.xml  and changed my original xml file by changing the one l
          
ine
  
to
      
  &VarNameStationPressure; as I show just above.  I also tried putti
          
ng t
  
he
      
following at the beginning of the CEOP_Insitu_Surface_Mongolia_DGS.xm
          
l fi
  
le:
      
<?xml version='1.0' ?>
<!DOCTYPE spec SYSTEM "spec.dtd" [

<!ENTITY VarNameStationPressure SYSTEM "Var_Name_Station_Pressure.xml">

]>

So, is it possible to put this one line (   <Station_Pressure name="S
          
tati
  
on
      
Pressure" units="hPa (mb)"> ) in a separate xml file and then put it 
          
into
  
 CE
      
OP_Insitu_Surface_Mongolia_DGS.xml  as an xml include?

If anyone has an existing xml file(s) as an example that you can send
          
 me
  
as
      
attached files, that would be the ideal and easy way to explain.

Thanks very much,

Ben




          
 
    

  

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement