Subject: Merging XML Help Please
Posted By: sam666 Post Date: 2/14/2006 5:26:47 AM
Hey,
I’m using an open source mmoprg game server but it uses xml for the database I will stick with XML for a while till I move on to MYSQL. But I am not experienced with XML and I am having trouble merging. I tried XMLSpy but on the second file it says not well formed and gave me errors there’s like 5-6k lines so I have no idea or what to do to fix this. It looks like it’s more indented then the other one so when I copy it on it doesn't line up.

This is the first XML File (Main one) there are like 60k lines.

http://rapidshare.de/files/13241364/ItemTemplate.xml.html

This is the second XML File I want to add this to the first one.

http://rapidshare.de/files/13241471/EpicArmor.xml

Anyone help me please?

Regards
Sam

Reply By: mhkay Reply Date: 2/14/2006 5:41:32 AM
The first file appears to be HTML rather than XML.

When you concatenate two well-formed XML documents the result is not a well-formed XML document. Perhaps this is your problem. This is because an XML document must have a single enclosing element. Given two documents

<doc1><x>......</x></doc1>

and

<doc2><y>......</y></doc2>

you can merge them by creating a new wrapper

<doc3>
  <doc1><x>......</x></doc1>
  <doc2><y>......</y></doc2>
</doc3>

or by replacing the existing wrappers with a new one:

<doc3>
  <x>......</x>
  <y>......</y>
</doc3>

It all depends what you want to achieve, which you haven't actually said.




Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply By: sam666 Reply Date: 2/14/2006 6:32:37 AM
I just want to add the second one to the first one. The second one is "items" for an NPC script the first one is the main item database.

Reply By: sam666 Reply Date: 2/15/2006 3:15:26 PM
bump

Reply By: ASKPOLY Reply Date: 3/5/2006 8:41:43 PM
I don't have a complete answer, but I need to do something similar.  I have one xml page that needs to import everthing from another xml page.  I've meet some success, but I do need help making this thing work properly.  Here is what I used

<?xml version="1.0" encoding="iso-8859-1"?>

<!DOCTYPE rows
    [
    <!ELEMENT rows (row+, linecode+, number+, line+, logo+, gate, claim?, city+, status?)>
    <!ATTLIST rows count CDATA "*">
    <!ELEMENT row (#PCDATA)>
    <!ATTLIST row id CDATA "*">
    <!ATTLIST row adi CDATA "*">
    <!ATTLIST row schudele CDATA "*">
    <!ATTLIST row actual CDATA "*">
    <!ELEMENT linecode (#PCDATA)>
    <!ATTLIST linecode order CDATA "*">
    <!ELEMENT number (#PCDATA)>
    <!ATTLIST number order CDATA "*">
    <!ELEMENT line (#PCDATA)>
    <!ATTLIST line order CDATA "*">
    <!ELEMENT logo (#PCDATA)>
    <!ATTLIST logo order CDATA "*">
    <!ELEMENT gate (#PCDATA)>
    <!ELEMENT claim (#PCDATA)>
    <!ELEMENT city (#PCDATA)>
    <!ATTLIST city order CDATA "*">
    <!ATTLIST ciy code CDATA "*">
    <!ELEMENT status (#PCDATA)>
    <!ATTLIST status code CDATA "*">
    <!ENTITY webfeed SYSTEM "eclipsxwebdatafeed.xml">
    ]
>
<rswfeed>
Arrival and Departures
&webfeed;
</rswfeed>

Thus the &webfeed; does pull in all the elements and attributes of the eclipsxwebdatafeed.xml, however, none of the text nodes nor the attribute values are pulled in.  WHY?  I would appreciate any type of answer some may have to offer.  That said, maybe this will help someone else with their problem and in turn they can provide an the final answer to mine.

Reply By: mhkay Reply Date: 3/6/2006 4:22:32 AM
>however, none of the text nodes nor the attribute values are pulled in

That's either a very serious bug in your XML parser, or an incorrect observation about what's really going on.

You need to supply more details about what you are doing to cause this apparent behaviour.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply By: ASKPOLY Reply Date: 3/7/2006 9:49:52 PM
OK, let me try to be a little more specific. Here are the first few rows of the exclipsxwebfeed.xml page

- <rows count="73">
- <row id="75277" adi="A" schedule="2006-02-25T15:10:00" actual="2006-02-25T23:20:00">
  <linecode order="1">LT</linecode>
  <number order="1">908</number>
  <line order="1">LTU International Airways</line>
  <logo order="1">Inline_LTU.gif</logo>
  <gate>B1</gate>
  <city order="1" code="DUS">Duesseldorf</city>
  </row>
- <row id="75278" adi="D" schedule="2006-02-25T16:55:00" actual="2006-02-26T00:45:00">
  <linecode order="1">LT</linecode>
  <number order="1">909</number>
  <line order="1">LTU International Airways</line>
  <logo order="1">Inline_LTU.gif</logo>
  <gate>B1</gate>
  <city order="1" code="DUS">Duesseldorf</city>
  </row>
</rows>

Now, when I run the xml sheet that is in my previous post, the result is:
- <rswfeed>
  Arrival and Departures
- <rows count="*">
- <row id="*" adi="*" schudele="*" actual="*">
  <linecode order="*" />
  <number order="*" />
  <line order="*" />
  <logo order="*" />
  <gate />
  <city order="*" />
  </row>
- <row id="*" adi="*" schudele="*" actual="*">
  <linecode order="*" />
  <number order="*" />
  <line order="*" />
  <logo order="*" />
  <gate />
  <city order="*" />
  </row>
</rswfeeds>

Note, none of the text nodes or attribute values are pulled in.

Allow me to be more complete.  My intent is to create an xml document that references an xsl document for display.  I do not have any control over the eclipsxwebfeed.xml document, it is provided via ftp, thus I can't connect that document to an xsl sheet.  I believe I need to create a new xml document that I do have control over that will link to the xsl document and control the display, but my data is the eclipsxwebfeed.xml doc.  I want to use just xml, xsl and html.  I like the built in options of xsl for sort and don't really want to build those options in java or vb.  Thanks

Reply By: mhkay Reply Date: 3/8/2006 1:50:53 AM
This looks pretty bizarre to me. I certainly can't reproduce it. This is what I get:

<?xml version="1.0" encoding="iso-8859-1"?><rswfeed>
Arrival and Departures
<rows count="73">
<row id="75277" adi="A" schedule="2006-02-25T15:10:00" actual="2006-02-25T23:20:00" schudele="*">
  <linecode order="1">LT</linecode>
  <number order="1">908</number>
  <line order="1">LTU International Airways</line>
  <logo order="1">Inline_LTU.gif</logo>
  <gate>B1</gate>
  <city order="1" code="DUS">Duesseldorf</city>
  </row>
  <row id="75278" adi="D" schedule="2006-02-25T16:55:00" actual="2006-02-26T00:45:00" schudele="*">
  <linecode order="1">LT</linecode>
  <number order="1">909</number>
  <line order="1">LTU International Airways</line>
  <logo order="1">Inline_LTU.gif</logo>
  <gate>B1</gate>
  <city order="1" code="DUS">Duesseldorf</city>
  </row>
</rows>
</rswfeed>

The only attribute that's been given a default value from the DTD is  schudele="*", because that attribute doesn't appear in the XML instance.

What are you actually doing to expand the XML entity references and display the result after expansion? Because it looks as if whatever you're doing, you're getting something wrong.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

Go to topic 41095

Return to index page 349
Return to index page 348
Return to index page 347
Return to index page 346
Return to index page 345
Return to index page 344
Return to index page 343
Return to index page 342
Return to index page 341
Return to index page 340