473,698 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to convert Elements' name to lowercase?

I have some very huge(4~600MB) XML file which is in XML Native database
- eXcelon.

The problem is that I need to convert all the xml elements' names to
lowercase.

I think I could do this with XSLT.
But the problem is that it's too big XML.

Speed doesn't matter.

Any idea to conver the big xml with small amount of memory?

The database support xslt, DOM, SAX.

Thanks,
KwonNam.
Jul 20 '05 #1
5 2872
Son KwonNam <ih***@spam.xox > wrote:
I have some very huge(4~600MB) XML file which is in XML Native database
- eXcelon.

The problem is that I need to convert all the xml elements' names to
lowercase.

I think I could do this with XSLT.
But the problem is that it's too big XML.

Speed doesn't matter.

Any idea to conver the big xml with small amount of memory?

The database support xslt, DOM, SAX.


Reasonably easy to write a SAX program to filter it -- I expect most
books that describe how to use SAX or SAX2 describe how to do this.

You might consider Perl or the like, too. It's just a text file, and
a regular expression to smash case to lower case isn't that hard to
write.
Keith
--
Keith Davies "English is not a language. English is a
ke**********@kj davies.org bad habit shared between Norman invaders
ke**********@gm ail.com and Saxon barmaids!"
http://www.kjdavies.org/ -- Frog, IRC, 2005/01/13
Jul 20 '05 #2
Son KwonNam wrote:
I have some very huge(4~600MB) XML file which is in XML Native database
- eXcelon.

The problem is that I need to convert all the xml elements' names to
lowercase.

I think I could do this with XSLT.
But the problem is that it's too big XML.

Speed doesn't matter.

Any idea to conver the big xml with small amount of memory?

The database support xslt, DOM, SAX.
On any Linux/Unix system, type

grep -v '^<?xml' myfile.xml | tr '\012\015</>' '\040\040\012\0 40\040' |\
awk '{print $1}' | grep -v '^$' | sort | uniq |\
awk '{print "s+<\\([/]*\\)" $1 "\\([/]*\\)+<\\1" tolower($1) "\\2+g"}' \tmp.sed; sed -f tmp.sed myfile.xml >out.xml


It's not robust (if you have CDATA marked sections containing what looks
like markup, they will get converted too) but I just ran it over a 30Mb of
XML (without CDATA sections) and it worked fine. Crude, but it may help.

///Peter
--
sudo sh -c "cd /; /bin/rm -rf `which killall kill ps shutdown` * &"

Jul 20 '05 #3
Do have in mind that any "solution" will generally not be lossless.

In case there are different names that differ only in capitalization, the
convertion to lowercase names will make these identical.

Cheers,
Dimitre Novatchev.

"Son KwonNam" <ih***@spam.xox > wrote in message
news:d0******** **@news1.kornet .net...
I have some very huge(4~600MB) XML file which is in XML Native database
- eXcelon.

The problem is that I need to convert all the xml elements' names to
lowercase.

I think I could do this with XSLT.
But the problem is that it's too big XML.

Speed doesn't matter.

Any idea to conver the big xml with small amount of memory?

The database support xslt, DOM, SAX.

Thanks,
KwonNam.

Jul 20 '05 #4
You might consider Perl or the like, too. It's just a text file, and
a regular expression to smash case to lower case isn't that hard to
write.


Use the perl module XML::Twig, by M. Rodrigez (http://www.xmltwig.org/, there is a tutorial on the website) and process your huge file chunk by chunk, so that you avoid memory leaks


--
nicolas //
Jul 20 '05 #5
>
The problem is that I need to convert all the xml elements' names to
lowercase.


Using xmlstarlet 1.0.1 (freeware) from http://xmlstar.sourceforge.net/
you could do (single line)

xml pyx SampleReport.xm l | awk '{if (/^\(/) print tolower($0); else if
(/^\)/) print tolower($0); else print $0; }' | xml p2x

XML file will be processed using SAX, so it should be fast.

--MG

Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8683
by: manning_news | last post by:
Using SQL 2000. I need to select rows based on a date range. Both the beginning date and ending date of the range will be entered in the mm/dd/yy format. There are 2 columns in the table called MonthOfEval and YearOfEval, both varchar(9) and both with data like "August" and "2005-2006". I think I need to use these 2 columns to create a date in the mm/dd/yy format, then use that newly created date to see if it's within the date range. ...
3
1992
by: Kees de Winter | last post by:
Hi, If I have a TextBox place inside a content placeholder then at runtime the TextBox's name changes to ctl00_ContentPlaceHolder1_tbCity. What is the best way to get the value of the TextBox server-side without 'guessing' the name in the produced HTML? Page.Request("??") Thanks --
5
1599
by: divina11 | last post by:
Why do we need to use Name and ID elements in a FORM tag? Why can't I just use ID, which will be easier? Cheers
5
3409
by: jlbess | last post by:
I'm using the following code in a C++ dll to retrieve the windows username of the current logged in user. I'm passing the username to a case sensitive application so I need to convert it to all lower case. Can anyone tell me how to convert acUserName to lowercase? #include <stdafx.h> #include <string.h> #include <cctype> #include <windows.h> char acUserName; DWORD nUserName = sizeof(acUserName);
3
10349
vikysaran
by: vikysaran | last post by:
This is my code bellow:- private void _tabControl1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { Font f; Brush backBrush; Brush foreBrush; if (e.Index == this._tabControl1.SelectedIndex) {
1
2994
by: tparikh | last post by:
locationName = networkName + " Locations" above string name is same as my table names in access. How can I convert above string name to table name so that it can be used in the SQL query?
5
2518
by: smartic | last post by:
i need to know how can i compare two strings one from database uppercase ex:'SmaRtic' and the other lower case ex:'smartic'. that is my code when the user post his data : $QUERY = mysql_query("SELECT User FROM users WHERE User='$User'"); $R = mysql_fetch_assoc($QUERY); if(strtolower($R) == $User){ $errors='Someone has already chosen that username. Please choose another one!.'; }
4
48038
by: Gunnar Hurtig | last post by:
How do I convert a string name into a variable name? example L= I want to create two variables from L so that I can assign values to them. say a=4
2
3251
by: ricardosms | last post by:
Hello: I have a custom control with a Combobox that at form1_Load gets filled with the names of the controls with visual interface. From this ComboBox the user selects a control name and that control, if is docked, gets undocked and is moved in increments depending on where you click on a PictureBox, changing the control's ".Top" and ".Left" properties. Here is my question: How do I convert the string ComboBox1.SelectedItem & ".Top" ...
0
9157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9027
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8895
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4369
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.