How to Reformat Edge Outbound XML

Edge produces the outbound XML “reports” as unformatted XML, with no prettying white-space. So here’s how you make them look good again. There are two ways:

  1. Windows: Notepad++: using the Plugins->XML Tools->Pretty Print (XML only – with line breaks)
  2. Linux (like on the Edge server itself):
$ xmllinit -format 12345.M.D01022015T010203.P.XML

Extracting Total Paid Amount from Edge XML

Here’s a quick way to pull the total paid amount from the Edge XML files. You can use this technique to do lots of other extractions but this article will just be on paid amount. Using this technique you can also:

  • count the number of claims in a file
  • extract CSVs of fields of a claim
  • count claims and totals per plan id
  • transform XML to fix problems
  • and so much more

The tool I’m showing is called “xmlstarlet”. It’s a command-line tool for extracting or transforming data in an XML file. For repetitive tasks, I would write a program in a easier to read language but it’s tough to beat this for adhoc tasks. Xmlstarlet can be installed via yum, cygwin setup, or if you must, you can get a windows version as well.

Sum Paid Amount

This will sum up all of the policyPaidTotalAmounts in a single file:

$ xmlstarlet sel -N x="" -t -v "sum(//x:policyPaidTotalAmount)" -n 12345.M.D01012015T010101.P.XML

Running this will print a single dollar amount for the entire file. Notice that I declared the namespace to be “x”. If you have a namespace in your file, you must declare it, as gross as that is.

If you uploaded claims in multiple files on say 2015-01-01, then you would have to do something like this to get a sum of all the claims:

$ for file in 12345.M.D01012015*.P.XML; do 
  xmlstarlet sel -N x="" -t -v "sum(//x:policyPaidTotalAmount)" -n $file; 
done | awk '{sum+=$1} END {printf("%0.2f\n",sum);}'

That will run all of the selected files through xmlstarlet, producing a separate line for each file, then the “awk” part sums up all the lines into a single sum.

Edge Inbound/Outbound XML Validation with XSDs

Lots of people probably don’t realize that one can validate Edge XML documents. This comes in handy if you have generated an XML file or have edited a file by hand and want to ensure that it is still valid. The easiest solution is to use an XML-aware editor and have it validate against the XSDs. Now, CMS has made this as difficult as possible for you, of course by making their XSDs load with relative paths and by confusing us all with what we refer to as “the namespace debacle”. I don’t really want to get to much off on a rant here, but these XSD look like they were produced by a monkey. The tag names make me weep, and the schema includes in the XSDs use relative pathing. And, they don’t use a numbered release for the schema changes. Clearly, a monkey banged these out over millions of years. Oh, and you don’t even need to use namespaces in your files. CMS/Accenture claimed at one time that you did need to use them or the files would reject. This is just simply not true, and this all shows Accenture’s lack of knowledge about XML and XSD. You can’t actually force the use of a namespace. Anyway, I suggest you don’t use any namespace because it makes your files difficult to view and manipulate in other tools.

Anyway, we have uploaded the XSDs to this website and properly positioned them so they can be accessed from anywhere and used to validate. The XSDs are buried down in their goofy paths, and we’ve prefaced these paths with the lame dates that they have used in the XSD zips. For example, the XSD for enrollment (EdgeServerEnrollmentSubmission.xsd) is, currently, in the 071814 folder because that what CMS called the original zip file containing it.

Here are the steps using Notepad++. This is a free multi-purpose editor which you can download and install – it’s awesome. If you don’t have it now, you need it now!

Notepad++ Setup:

  1. Download from
  2. Use the Plugin manager to install “XML Tool

Validating a file:

  1. Load an XML file into Notepad++ normally
  2. [optional] Format ugly docs with Plugins->XML Tools->Pretty Print (XML only – with line breaks)
  3. …make your changes
  4. Choose Plugins->XML Tools->Validate now
  5. Type the URL of the XSD using the table below, for example:
  6. If the file validates successfully, you’ll get a little popup saying so. If it fails, you’ll get a list of very cryptic errors. My only suggestion would be to google those.

For a slightly better experience, I suggest commercial XML editors like XMLSpy. All of the XSDs are uploaded but my table below is not quite fully spec’d out, so if you don’t see it below, hunt and you’ll find the XSDs for all of the files.

Type Abbrev Location
Enrollment E
Medical Claims M
Pharmacy Claims P
Supplemental S



Welcome the Edgy.Guru! This site is dedicated to the free exchange of knowledge on the CMS/HHS Edge Server. The members of this site are motivated and dedicated to the following principles:

  1. Openness – the only way we will all succeed with Edge is to collaborate with each other
  2. Anonymity – this site will never share names or email addresses with anyone, guaranteed
  3. Authority – we, the companies, are the experts, and take on the risk. We have much more power than we realize. We need to use some of that power and push-back on CMS en-masse and guide how the Edge system develops.

So, we’re developing this site right now. The plan is to have a few many collaborations here – forums and Q&A. In addition, we’ll try to have articles, FAQs, and searchable documents. The goal is to provide a site that has everything we need to do our jobs on Edge, and not rely on the ridiculous site, and gets questions much faster than wasting our lives away sitting in queue on CMS calls, hoping to gain snippets of wisdom.

All the information on this site is, of course, the opinions of it’s members, and doesn’t represent the opinions of our companies. The site takes no responsibility for misinformation gained from this site. All that said, we’re pretty sure you’re going to find things here that you will find nowhere else.