Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 14th, 2006, 06:26 AM
Registered User
 
Join Date: Feb 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Merging XML Help Please

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/...plate.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

 
Old February 14th, 2006, 06:41 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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
 
Old February 14th, 2006, 07:32 AM
Registered User
 
Join Date: Feb 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

 
Old February 15th, 2006, 04:15 PM
Registered User
 
Join Date: Feb 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

bump

 
Old March 5th, 2006, 09:41 PM
Registered User
 
Join Date: Jul 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

 
Old March 6th, 2006, 05:22 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

>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
 
Old March 7th, 2006, 10:49 PM
Registered User
 
Join Date: Jul 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old March 8th, 2006, 02:50 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
merging 2 xml with xslt gbordel XSLT 7 April 24th, 2008 05:27 AM
merging xml using xslt sormel XSLT 1 July 9th, 2007 06:07 PM
merging a node from one XML to another pravind XSLT 3 February 21st, 2006 05:04 AM
Merging 2 Xml docs nkuar XML 3 December 8th, 2005 05:22 AM
merging 2 xml documents espider4u XSLT 0 August 31st, 2004 11:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.